package com.burgeon.backend.SHOPBACKEND.controller;


import com.burgeon.backend.SHOPBACKEND.service.BackendInviteService;
import com.burgeon.backend.stsutil.ResponseResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.HashMap;


@CrossOrigin
@RestController
@RequestMapping("backend/invite")
public class BackendInviteController extends BaseController {

    @Autowired
    private BackendInviteService backendInviteService;

    //邀约页面头部数据
    @RequestMapping("rvisittot")
    public ResponseResult<HashMap> RVISITTOT(String type,String account) {

        HashMap data = backendInviteService.RVISITTOT(type, account);
        return new ResponseResult<HashMap>(SUCCESS,data);
    }

    @RequestMapping("delExpressionsData")
    public ResponseResult<Void> delExpressionsData(String id, String account) {
        backendInviteService.delExpressionsData(id,account);
        return new ResponseResult<>(SUCCESS);
    }

    @RequestMapping("upExpressionsData")
    public ResponseResult<Void> upExpressionsData(String id,String type, String value, String account) {
        backendInviteService.upExpressionsData(id,type,value,account);
        return new ResponseResult<>(SUCCESS);
    }

    @RequestMapping("addExpressionsData")
    public ResponseResult<Void> addExpressionsData(String type, String value, String account) {
        backendInviteService.addExpressionsData(type, value, account);
        return new ResponseResult<>(SUCCESS);
    }

    @RequestMapping("expressionsData")
    public ResponseResult<HashMap> expressionsData(String type, String account) {
        HashMap data = backendInviteService.expressionsData(type, account);
        return new ResponseResult<HashMap>(SUCCESS, data);
    }


    @RequestMapping("getData")
    public ResponseResult<HashMap> getData(String type, Integer start, String account) {
        HashMap data = backendInviteService.getDataByType(type, start, account);
        return new ResponseResult<HashMap>(SUCCESS, data);
    }

    /**
     * @param field   A 会员卡号 B 会员名 C 导购名 D 店铺 E 类型:1:生日邀约,2:休眠邀约,
     *        3:活动邀约,4:储值邀约,5:新品邀约, F 日期
     * @param message
     * @param type
     * @param start
     * @param account
     * @return
     */

    @RequestMapping("findData")
    public ResponseResult<HashMap> findData(String field, String message, String type, Integer start, String account) {
        HashMap data = backendInviteService.FindData(field, message, type, start, account);
        return new ResponseResult<HashMap>(SUCCESS, data);
    }
}
